package com.zhang;


public class Test {
    public static void main(String[] args) {
        ArrayList2<Integer> list = new ArrayList2<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        System.out.println(list); // [1,2,3,4]
        list.add(1, 5);
        System.out.println(list); // [1,5,2,3,4]
        list.add(2, 6);
        System.out.println(list); // [1,5,6,2,3,4]
        list.add(7);
        System.out.println(list); // [1,5,6,2,3,4,7]
        System.out.println(list.indexOf(7));
        list.add(1, 8);
        System.out.println(list); // [1,8,5,6,2,3,4,7]
        System.out.println(list);
        System.out.println(list.remove(0));
        System.out.println(list);
        System.out.println(list.remove(0));
        System.out.println(list);
        System.out.println(list.remove(0));
        System.out.println(list);
        System.out.println(list.remove(0));
    }
}
